package com.ctn.information.data.service;

import com.ctn.information.data.retriever.Retriever;
import com.ctn.information.data.retriever.Interface.ADRetriever;
import com.ctn.information.data.retriever.Interface.MenuRetriever;
import com.ctn.information.data.retriever.Interface.NewsCommentRetriever;
import com.ctn.information.data.retriever.Interface.NewsContentRetriever;
import com.ctn.information.data.retriever.Interface.NewsTitleRetriever;
import com.ctn.information.data.retriever.impl.sample.ADRetrieverSampleImpl;
import com.ctn.information.data.retriever.impl.sample.MenuRetrieverSampleImpl;
import com.ctn.information.data.retriever.impl.sample.NewsCommentRetrieverSampleImpl;
import com.ctn.information.data.retriever.impl.sample.NewsContentRetrieverSampleImpl;
import com.ctn.information.data.retriever.impl.sample.NewsTitleRetrieverSampleImpl;


public class RetrieverUtil {
	private static MenuRetriever menuRetriever;
	private static NewsTitleRetriever newsTitleRetriever;
	private static NewsCommentRetriever newsCommentRetriever;
	private static NewsContentRetriever newsContentRetriever;
	private static ADRetriever adRetriever;
	public static Retriever getRetriever(String type){
		Retriever result = null;
		if(Retriever.RETRIEVER_MENU.equals(type)){
			result = getMenuRetriever();
		}else if(Retriever.RETRIEVER_NEWS_COMMENT.equals(type)){
			result = getNewsCommentRetriever();
		}else if(Retriever.RETRIEVER_NEWS_CONTENT.equals(type)){
			result = getNewsContentRetriever();
		}else if(Retriever.RETRIEVER_NEWS_TITLE.equals(type)){
			result = getNewsTitleRetriever();
		}else if(Retriever.RETRIEVER_AD.equals(type)){
			result = getADRetriever();
		}
		return result;
	}
	private static Retriever getADRetriever() {
		if(adRetriever == null){
			adRetriever = new ADRetrieverSampleImpl();
		}
		return adRetriever;
	}
	public static MenuRetriever getMenuRetriever() {
		if(menuRetriever == null){
			menuRetriever = new MenuRetrieverSampleImpl();
		}
		return menuRetriever;
	}
	public static NewsTitleRetriever getNewsTitleRetriever() {
		if(newsTitleRetriever ==null){
			newsTitleRetriever = new NewsTitleRetrieverSampleImpl();
		}
		return newsTitleRetriever;
	}
	public static NewsCommentRetriever getNewsCommentRetriever() {
		if(newsCommentRetriever ==null){
			newsCommentRetriever = new NewsCommentRetrieverSampleImpl();
		}
		return newsCommentRetriever;
	}
	public static NewsContentRetriever getNewsContentRetriever() {
		if(newsContentRetriever == null){
			newsContentRetriever = new NewsContentRetrieverSampleImpl();
		}
		return newsContentRetriever;
	}
	
	
	
	
}
